package com.elite.xml.service.impl;

import com.elite.xml.entity.User;
import com.elite.xml.mapper.StudentMapper;
import com.elite.xml.mapper.UserMapper;
import com.elite.xml.service.AUserService;
import com.elite.xml.service.BUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Service("aUserServiceImpl")
public class AUserServiceImpl implements AUserService {

	@Autowired
	private UserMapper userMapper;
	@Autowired
	private StudentMapper studentMapper;


	@Autowired
	private AUserService aUserService;
//	@Autowired
//	private BUserService bUserService;

	public UserMapper getUserMapper() {
		return userMapper;
	}
	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}


	@Transactional(transactionManager = "dataSourceTransactionManager1")
	@Override
	public User queryOne(Long id) {
		return aUserService.queryOneNested(id);
	}
	@Transactional(transactionManager = "dataSourceTransactionManager1")
	@Override
	public User queryOneSimple(Long id) {
		User user1 = userMapper.queryOne(id);
		return user1;
	}

	@Transactional(transactionManager = "dataSourceTransactionManager1",propagation = Propagation.NESTED)
	@Override
	public User queryOneNested(Long id) {
		throw new RuntimeException();
//		return userMapper.queryOne(id);
	}


//	public BUserService getbUserService() {
//		return bUserService;
//	}
//
//	public void setbUserService(BUserService bUserService) {
//		this.bUserService = bUserService;
//	}
}
